package com.ywl.designpattern.strategy;

/**
 * 3.创建一个上下文类,它使用这些策略
 * @author yuwl
 * @description
 * @since 2024-06-27 16:02
 */
public class ShoppingCart {

    private PaymentStrategy paymentStrategy;

    public void setPaymentStrategy(PaymentStrategy paymentStrategy) {
        this.paymentStrategy = paymentStrategy;
    }

    public void checkout(int amount) {
        paymentStrategy.pay(amount);
    }
}
